package com.hanthink.system.service.impl.repair;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hanthink.common.constant.BusinessConstants;
import com.hanthink.system.domain.repair.RepairRecordTime;
import com.hanthink.system.mapper.repair.RepairRecoedMapper;
import com.hanthink.system.mapper.repair.RepairRecordTimeMapper;
import com.hanthink.system.service.repair.IRepairRecordTimeService;

@Service
public class IRepairRecordTimeServiceImpl implements IRepairRecordTimeService {

	@Autowired
	private RepairRecordTimeMapper repairRecordTimeMapper;

	@Autowired
	private RepairRecoedMapper repairRecoedMapper;

	@Override
	public void updateRecordTime(RepairRecordTime repairRecordTime) {

		repairRecordTimeMapper.updateRecordTime(repairRecordTime);

		// 判断更新类型是否为暂停
		if (BusinessConstants.REPAIR_RECORD_TIME_STOP == repairRecordTime.getType()) {
			// 更新维修记录状态
			Map<String, Object> params = new HashMap<String, Object>();
			params.put("status", BusinessConstants.REPAIR_STATUS_STOP);
			params.put("id", repairRecordTime.getRecordId());
			params.put("faultType", null);
			repairRecoedMapper.updateRepairStatus(params);
		}

	}

}
